using System;
using System.Collections.Generic;

using Azure.Infrastructure;

namespace Azure.Web.Stubs
{
    public class StubQueue<T> : IQueue<T> where T : IMessage
    {
        private readonly Queue<T> _queue = new Queue<T>();

        public void Enqueue(T item)
        {
            _queue.Enqueue(item);
        }

        public QueuedMessage<T> Dequeue(TimeSpan timeout)
        {
            return new QueuedMessage<T>(null, Guid.NewGuid().ToString(), DateTime.UtcNow, _queue.Dequeue());
        }
    }
}